export function parseStyledString(input: string) {
  const result = [];
  let currentIndex = 0;
  const regex = /\{([^{}]+?)-(\d+)-([^{}]+?)\}/g;
  let match;

  while ((match = regex.exec(input)) !== null) {
    // 处理匹配前的普通文本
    if (match.index > currentIndex) {
      const text = input.substring(currentIndex, match.index);
      if (text) {
        result.push({
          text,
          fontWeight: 400,
          color: 'black',
        });
      }
    }

    // 处理特殊格式部分
    const [fullMatch, text, fontWeightStr, color] = match;
    result.push({
      text,
      fontWeight: parseInt(fontWeightStr, 10),
      color,
    });

    // 更新当前索引
    currentIndex = match.index + fullMatch.length;
  }

  // 处理剩余普通文本
  if (currentIndex < input.length) {
    const text = input.substring(currentIndex);
    result.push({
      text,
      fontWeight: 400,
      color: 'black',
    });
  }

  return result;
}
